﻿@using MvcPager;
@using WEF.MvcPager;
@using WebBaseFrame.Models
@using Libraries;
@model PagedList<Member>
<table class="table table-striped">
    <thead>
        <tr>
            <th class="checkbox-column">
                <input type="checkbox" name="checkall" onchange="selectall(this,'ID')" />
            </th>
            <th class="sorting" data-sort="ID">#</th>
            <th class="sorting" data-sort="UserName">用户名</th>
            <th class="sorting" data-sort="PwdNotMD5">密码</th>
            <th class="sorting" data-sort="RealName">姓名</th>
            <th class="sorting" data-sort="RoleID">角色</th>
            <th class="sorting" data-sort="Mobile">手机</th>
            <th class="sorting" data-sort="Email">邮箱</th>
            <th class="btns-column">
                操作
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            var rt = new RoleRepository().GetRole(item.RoleID);
            if (rt != null && rt.ID > 0)
            {
                <tr>
                    <td class="checkbox-column">
                        <input type="checkbox" name="ID" value="@item.ID" />
                    </td>
                    <td>@item.ID</td>
                    <td>@item.UserName</td>
                    <td>@item.PwdNotMD5</td>
                    <td>@item.RealName</td>
                    <td>@rt.RoleName</td>
                    <td>@item.Mobile</td>
                    <td>@item.Email</td>
                    <td class="btns-column">
                        @Html.EditButton("编辑", "/admin/Member/Edit", new { href = "/admin/Member/Edit?id=" + item.ID })
                        @if (item.RoleID != 1)
                        {
                            @Html.DeleteButton("删除", "/admin/Member/Delete", new { href = "javascript:void(0);", onclick = "Delete('/admin/Member/Delete/" + item.ID + "',this,'one');" })
                        }
                    </td>
                </tr>
            }
        }
    </tbody>
</table>
<div class="dt_footer fixed">
    <div class="row-fluid">
        <div class="span4">
            <div class="dataTables_info" id="DataTables_Table_0_info">
                @Model.CurrentPageIndex/@Model.TotalPageCount 页, 共@(Model.TotalItemCount)条记录
            </div>
        </div>
        <div class="span8">
            <div class="pagination">@Html.Pager(Model)</div>
        </div>
    </div>
</div>
@Html.PermissionValideScript()